﻿using System;
using System.Collections.Generic;
using System.Linq;
using Mono.Cecil;
using MethodCaching.Weaving.Extensions;
namespace MethodCaching.Weaving
{
    /// <summary>
    /// Selects methods that are decorated with the <see cref="CachedAttribute"/>.
    /// </summary>
    public class AttributeMethodSelector : LambdaMethodSelector
    {
        /// <summary>
        /// Initializes a new instance of the <see cref="AttributeMethodSelector"/> class.
        /// </summary>
        public AttributeMethodSelector()
            : base(m =>
                       {
                           TypeReference attributeType = m.Module.Import(typeof(CachedAttribute));
                           return m.IsDefined(attributeType);
                       }) { }

        


    }
}
